import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/users/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/users/info',
    method: 'get',
    params: { token },
    validateStatus: function (status) {
      return status >= 200 && status < 500;
    }
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}
export function changePassword(data) {
  return request({
    url: '/users/reset-password',
    method: 'post',
    data
  })
}
export function register(data) {
  return request({
    url: '/users/register',
    method: 'post',
    data
  })
}
